<Window x:Class="EpubManga.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:manga="clr-namespace:EpubManga"
        Title="Manga to Epub" Height="245"  Width="800" ResizeMode="NoResize">

    <Window.Resources>
        <ResourceDictionary Source="./Styles/Style.xaml"/>
    </Window.Resources>

    <Grid>

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="10"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="10"/>
            <RowDefinition Height="27"/>
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="85"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="85"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        
        
        <TextBlock Grid.Row="0" Grid.Column="0" Text="Files"/>
        <DockPanel Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="3">
            <Button DockPanel.Dock="Right" Style="{StaticResource ImageButton}" ToolTip="Select Folder"
                Command="{Binding SelectInputFolderCommand}">
                <Image Source="./Images/Folder.png"/>
            </Button>
            <Button DockPanel.Dock="Right" Style="{StaticResource ImageButton}" ToolTip="Select Files"
                Command="{Binding SelectFilesCommand}">
                <Image Source="./Images/Image.png"/>
            </Button>

            <TextBox DockPanel.Dock="Left" IsReadOnly="True"
                Text="{Binding Data.Files, Converter={StaticResource ListStringToStringConv}, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" />
        </DockPanel>


        <TextBlock Grid.Row="1" Grid.Column="0" Text="Output Folder"/>
        <DockPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3">
            <Button DockPanel.Dock="Right" Style="{StaticResource ImageButton}" ToolTip="Select Folder"
                Command="{Binding SelectOutputFolderCommand}">
                <Image Source="./Images/Folder.png"/>
            </Button>

            <TextBox DockPanel.Dock="Left" IsReadOnly="True"
                Text="{Binding Data.OutputFolder, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" />
        </DockPanel>


        <TextBlock Grid.Row="2" Grid.Column="0" Text="Title"/>
        <TextBox Grid.Row="2" Grid.Column="1"
            IsReadOnly="{Binding IsBusy, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
            Text="{Binding Data.Title, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />

        <TextBlock Grid.Row="2" Grid.Column="2" Text="Author"/>
        <TextBox Grid.Row="2" Grid.Column="3"
            IsReadOnly="{Binding IsBusy, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
            Text="{Binding Data.Author, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />


        <TextBlock Grid.Row="3" Grid.Column="0" Text="Output File"/>
        <TextBox Grid.Row="3" Grid.Column="1"
            manga:TextBoxExtension.Regexp="FileName"
            IsReadOnly="{Binding IsBusy, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
            Text="{Binding Data.OutputFile, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />
        
        
        <manga:Options Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="4"/>


        <Button Grid.Row="7" Grid.Column="0" Content="Preview"
            Command="{Binding ShowPreviewCommand}"/>

        <Grid Grid.Row="7" Grid.Column="1" Grid.ColumnSpan="3">
            
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="85"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <Button Grid.Column="0" Content="Generate"
                Command="{Binding GenerateCommand}" />

            <ProgressBar Grid.Column="1" Minimum="0"
                Maximum="{Binding TotalImages, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
                Value="{Binding TreatedImages, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}" />

        </Grid>

    </Grid>
    
</Window>